package org.alanlau.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 用于测试消息签收
 *
 * @author alan
 * @version 1.0
 * @date 2021/4/8 18:18
 */
@Configuration
public class MsgAckConfig {
    /**
     * 声明交换机
     *
     * @return 交换机
     */
    @Bean
    public FanoutExchange actFanoutExchange() {
        return new FanoutExchange("boot.msg.act");
    }

    /**
     * 声明队列
     *
     * @return 队列
     */
    @Bean
    public Queue actFanoutQueue1() {
        return new Queue("boot.msg.act.queue");
    }

    /**
     * 把fanout_queue1队列绑定到交换机
     *
     * @return 交换机
     */
    @Bean
    public Binding binding7() {
        return BindingBuilder.bind(actFanoutQueue1()).to(actFanoutExchange());
    }
}
